
 package com.ami.kvm.jviewer.gui;
 
 import com.ami.kvm.jviewer.Debug;
 import java.awt.Color;
 import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
 import java.awt.Point;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
 import java.io.File;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JDialog;
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
 
 
 
 
 
 class VideoRecordSettings
   extends JDialog
   implements ActionListener
 {
   private static final long serialVersionUID = 1L;
   public int Frame_Interval;
   public int Frame_No;
   public String StoreLocation = null;
   public String videoType = ".avi";
   private JPanel jContentPane = null;
   private JLabel jVideoLengthLabel = null;
   private JTextField videoLengthText = null;
   private JLabel path = null;
   private JTextField videoStorageLocationTextField = null;
   private JButton Browse = null;
   private JFileChooser fc;
   private JButton okButton = null;
   private JButton cancelButton = null;
   private JCheckBox recordMode = null;
   private JLabel recordModeLabel = null;
   private final int MAX_VIDEO_LENGTH = 1800;
   
   public static final int WIDTH = 450;
   
   public static final int HEIGHT = 250;
   
 
   public VideoRecordSettings(JFrame paramJFrame)
   {
     super(paramJFrame);
     initialize();
   }
   
 
 
 
 
   private void initialize()
   {
     setSize(450, 250);
     setMinimumSize(new Dimension(450, 250));
     Point localPoint = JViewerApp.getInstance().getPopUpWindowPosition(450, 250);
     setLocation(localPoint);
     setTitle(LocaleStrings.getString("U_5_VR"));
     setModal(true);
     getContentPane().setLayout(new GridBagLayout());
     GridBagConstraints localGridBagConstraints = new GridBagConstraints();
     localGridBagConstraints.fill = 2;
     localGridBagConstraints.insets = new Insets(5, 10, 5, 10);
     localGridBagConstraints.gridheight = 1;
     localGridBagConstraints.gridwidth = 1;
     localGridBagConstraints.gridx = 0;
     localGridBagConstraints.gridy = 0;
     localGridBagConstraints.weightx = 1.0D;
     getContentPane().add(getVideoLengthPanel(), localGridBagConstraints);
     localGridBagConstraints.gridy = 1;
     getContentPane().add(getVideoLocationPanel(), localGridBagConstraints);
     localGridBagConstraints.gridy = 2;
     getContentPane().add(getDecisionControlsPanel(), localGridBagConstraints);
   }
   
 
 
   private void close()
   {
     setVisible(false);
   }
   
 
 
 
 
   public JPanel getJContentPane()
   {
     if (this.jContentPane == null)
     {
       this.jContentPane = new JPanel();
       this.jContentPane.setLayout(new GridBagLayout());
       GridBagConstraints localGridBagConstraints = new GridBagConstraints();
       localGridBagConstraints.fill = 2;
       localGridBagConstraints.insets = new Insets(2, 5, 5, 5);
       localGridBagConstraints.gridheight = 1;
       localGridBagConstraints.gridwidth = 1;
       localGridBagConstraints.gridx = 0;
       localGridBagConstraints.gridy = 0;
       localGridBagConstraints.weightx = 1.0D;
       
       this.jContentPane.add(getVideoLengthLabel(), null);
       this.jContentPane.add(getSecondsLabel(), null);
       this.jContentPane.add(getStorageLocationLabel(), null);
       this.jContentPane.add(getVideoLenghtText(), null);
       this.jContentPane.add(getVideoStorageLocationTextField(), null);
       this.jContentPane.add(getBrowse(), null);
       this.jContentPane.add(getRecordMode(), null);
       this.jContentPane.add(getRecordModeLabel(), null);
       this.jContentPane.add(getOkButton(), null);
       this.jContentPane.add(getCancelButton(), null);
     }
     return this.jContentPane;
   }
   
 
 
 
   private JPanel getVideoLengthPanel()
   {
     JPanel localJPanel = new JPanel(new GridBagLayout());
     GridBagConstraints localGridBagConstraints = new GridBagConstraints();
     localGridBagConstraints.fill = 2;
     localGridBagConstraints.insets = new Insets(2, 5, 2, 5);
     localGridBagConstraints.gridheight = 1;
     localGridBagConstraints.gridwidth = 1;
     localGridBagConstraints.gridx = 0;
     localGridBagConstraints.gridy = 0;
     localGridBagConstraints.weightx = 0.0D;
     localJPanel.add(getVideoLengthLabel(), localGridBagConstraints);
     localGridBagConstraints.ipadx = 30;
     localGridBagConstraints.gridx = 1;
     localJPanel.add(getVideoLenghtText(), localGridBagConstraints);
     localGridBagConstraints.ipadx = 0;
     localGridBagConstraints.gridx = 2;
     localJPanel.add(getSecondsLabel(), localGridBagConstraints);
     localGridBagConstraints.weightx = 1.0D;
     localGridBagConstraints.gridx = 3;
     localJPanel.add(new JPanel(), localGridBagConstraints);
     return localJPanel;
   }
   
 
 
 
   private JPanel getVideoLocationPanel()
   {
     JPanel localJPanel = new JPanel(new GridBagLayout());
     GridBagConstraints localGridBagConstraints = new GridBagConstraints();
     localGridBagConstraints.fill = 2;
     localGridBagConstraints.insets = new Insets(2, 2, 2, 5);
     localGridBagConstraints.gridheight = 1;
     localGridBagConstraints.gridwidth = 1;
     localGridBagConstraints.gridx = 0;
     localGridBagConstraints.gridy = 0;
     localGridBagConstraints.weightx = 1.0D;
     localJPanel.add(getStorageLocationLabel(), localGridBagConstraints);
     localGridBagConstraints.insets = new Insets(0, 2, 0, 0);
     localGridBagConstraints.gridy = 1;
     localJPanel.add(getVideoLocationBrowsePanel(), localGridBagConstraints);
     return localJPanel;
   }
   
 
 
 
 
   private JPanel getVideoLocationBrowsePanel()
   {
     JPanel localJPanel = new JPanel(new GridBagLayout());
     GridBagConstraints localGridBagConstraints = new GridBagConstraints();
     localGridBagConstraints.fill = 2;
     localGridBagConstraints.insets = new Insets(5, 0, 2, 5);
     localGridBagConstraints.gridheight = 1;
     localGridBagConstraints.gridwidth = 1;
     localGridBagConstraints.gridx = 0;
     localGridBagConstraints.gridy = 0;
     localGridBagConstraints.weightx = 1.0D;
     localGridBagConstraints.ipady = 5;
     localJPanel.add(getVideoStorageLocationTextField(), localGridBagConstraints);
     localGridBagConstraints.insets = new Insets(5, 5, 2, 5);
     localGridBagConstraints.gridx = 1;
     localGridBagConstraints.ipady = 0;
     localGridBagConstraints.weightx = 0.0D;
     localJPanel.add(getBrowse(), localGridBagConstraints);
     return localJPanel;
   }
   
 
 
 
   private JPanel getDecisionControlsPanel()
   {
     JPanel localJPanel = new JPanel(new GridBagLayout());
     GridBagConstraints localGridBagConstraints = new GridBagConstraints();
     localGridBagConstraints.fill = 2;
     localGridBagConstraints.insets = new Insets(2, 5, 2, 5);
     localGridBagConstraints.gridheight = 1;
     localGridBagConstraints.gridwidth = 1;
     localGridBagConstraints.gridx = 0;
     localGridBagConstraints.gridy = 0;
     localGridBagConstraints.weightx = 1.0D;
     localJPanel.add(new JPanel(), localGridBagConstraints);
     localGridBagConstraints.gridx = 2;
     localGridBagConstraints.weightx = 0.0D;
     localJPanel.add(getOkButton(), localGridBagConstraints);
     localGridBagConstraints.gridx = 0;
     localGridBagConstraints.gridy = 1;
     localGridBagConstraints.insets = new Insets(1, 5, 1, 5);
     localJPanel.add(getRecordMode(), localGridBagConstraints);
     localGridBagConstraints.gridy = 2;
     localGridBagConstraints.weightx = 1.0D;
     localJPanel.add(getRecordModeLabel(), localGridBagConstraints);
     localGridBagConstraints.gridx = 2;
     localGridBagConstraints.weightx = 0.0D;
     localJPanel.add(getCancelButton(), localGridBagConstraints);
     return localJPanel;
   }
   
 
 
 
 
   private JLabel getVideoLengthLabel()
   {
     this.jVideoLengthLabel = new JLabel();
     this.jVideoLengthLabel.setHorizontalTextPosition(2);
     this.jVideoLengthLabel.setHorizontalAlignment(2);
     this.jVideoLengthLabel.setText(LocaleStrings.getString("V_1_VRS"));
     
     return this.jVideoLengthLabel;
   }
   
 
 
 
 
   private JTextField getVideoLenghtText()
   {
     if (this.videoLengthText == null)
     {
       this.videoLengthText = new JTextField();
       this.videoLengthText.setText("20");
       this.videoLengthText.addKeyListener(new KeyAdapter() {
         public void keyReleased(KeyEvent paramAnonymousKeyEvent) {
           String str = VideoRecordSettings.this.videoLengthText.getText();
           if ((str.length() >= String.valueOf(1800).length()) && 
             (Integer.parseInt(str) > 1800)) {
             VideoRecordSettings.this.showMessage(LocaleStrings.getString("V_2_VRS") + 1800 + ")");
             str = String.valueOf(1800);
             paramAnonymousKeyEvent.consume();
             VideoRecordSettings.this.videoLengthText.setText(str);
             VideoRecordSettings.this.videoLengthText.selectAll();
           }
         }
       });
     }
     
     return this.videoLengthText;
   }
   
 
 
 
 
 
   private JLabel getSecondsLabel()
   {
     this.jVideoLengthLabel = new JLabel();
     this.jVideoLengthLabel.setHorizontalAlignment(2);
     this.jVideoLengthLabel.setText(LocaleStrings.getString("V_3_VRS"));
     
     return this.jVideoLengthLabel;
   }
   
 
 
 
 
 
   private JLabel getStorageLocationLabel()
   {
     this.path = new JLabel();
     this.path.setHorizontalAlignment(2);
     this.path.setText(LocaleStrings.getString("V_4_VRS"));
     return this.path;
   }
   
 
 
 
 
   JTextField getVideoStorageLocationTextField()
   {
     if (this.videoStorageLocationTextField == null)
     {
       this.videoStorageLocationTextField = new JTextField();
       this.videoStorageLocationTextField.addActionListener(this);
       this.videoStorageLocationTextField.setEditable(false);
       this.videoStorageLocationTextField.setBackground(Color.WHITE);
     }
     return this.videoStorageLocationTextField;
   }
   
 
 
 
 
   private JButton getBrowse()
   {
     if (this.Browse == null)
     {
       this.Browse = new JButton();
       this.Browse.setText(LocaleStrings.getString("A_1_DP"));
       this.Browse.addActionListener(this);
     }
     
     return this.Browse;
   }
   
 
 
 
 
 
   private JCheckBox getRecordMode()
   {
     this.recordMode = new JCheckBox(LocaleStrings.getString("V_5_VRS"));
     this.recordMode.setBorder(null);
     this.recordMode.setSelected(true);
     this.recordMode.addActionListener(this);
     return this.recordMode;
   }
   
   private JLabel getRecordModeLabel()
   {
     this.recordModeLabel = new JLabel();
     this.recordModeLabel.setHorizontalTextPosition(2);
     this.recordModeLabel.setHorizontalAlignment(2);
     this.recordModeLabel.setText(LocaleStrings.getString("V_6_VRS"));
     
     return this.recordModeLabel;
   }
   
 
 
 
 
 
   private JButton getOkButton()
   {
     if (this.okButton == null)
     {
       this.okButton = new JButton();
       this.okButton.setText(LocaleStrings.getString("A_3_GLOBAL"));
       this.okButton.addActionListener(this);
     }
     return this.okButton;
   }
   
 
 
 
   private JButton getCancelButton()
   {
     if (this.cancelButton == null)
     {
       this.cancelButton = new JButton();
       this.cancelButton.setText(LocaleStrings.getString("A_4_GLOBAL"));
       this.cancelButton.addActionListener(this);
     }
     return this.cancelButton;
   }
   
 
 
   public void showMessage(String paramString)
   {
     JOptionPane.showMessageDialog(this.jContentPane, paramString, LocaleStrings.getString("V_7_VRS"), 0);
   }
   
 
 
 
 
 
 
   private boolean isValidNumber(String paramString)
   {
     int i = Integer.parseInt(paramString);
     if ((i < 1) || (i > 1800)) {
       return false;
     }
     return true;
   }
   
 
 
 
 
   private boolean directoryCheck(String paramString)
   {
     File localFile = new File(paramString);
     if (localFile.isDirectory()) {
       return true;
     }
     return false;
   }
   
 
 
 
 
   private boolean isParsableToInt(String paramString)
   {
     try
     {
       Integer.parseInt(paramString);
       return true;
     } catch (NumberFormatException localNumberFormatException) {
       Debug.out.println(localNumberFormatException); }
     return false;
   }
   
 
   public void actionPerformed(ActionEvent paramActionEvent)
   {
     if (paramActionEvent.getSource() == this.Browse)
     {
       this.fc = new JFileChooser(this.StoreLocation);
       this.fc.setFileSelectionMode(1);
       customizefilechooser localcustomizefilechooser = new customizefilechooser();
       localcustomizefilechooser.customizeFileChooser(this.fc);
       
       int i = this.fc.showDialog(this, LocaleStrings.getString("V_8_VRS"));
       if (i == 0) {
         if (this.fc.getSelectedFile().exists()) {
           this.StoreLocation = this.fc.getSelectedFile().toString();
         } else
           this.StoreLocation = this.fc.getSelectedFile().getParent();
       }
       this.videoStorageLocationTextField.setText(this.StoreLocation);
     }
     
     if (paramActionEvent.getSource() == this.okButton) {
       if (this.videoStorageLocationTextField.getText().length() == 0)
       {
         showMessage(LocaleStrings.getString("V_9_VRS"));
       }
       else if (!directoryCheck(this.StoreLocation)) {
         showMessage(LocaleStrings.getString("V_9_VRS"));
       }
       else if (this.videoLengthText.getText().length() == 0)
       {
         showMessage(LocaleStrings.getString("V_10_VRS"));
       }
       else if ((!isParsableToInt(this.videoLengthText.getText())) || (!isValidNumber(this.videoLengthText.getText())))
       {
         showMessage(LocaleStrings.getString("V_2_VRS") + 1800 + ")");
         this.videoLengthText.requestFocus();
         this.videoLengthText.setText(String.valueOf(1800));
         this.videoLengthText.selectAll();
       }
       else
       {
         close();
         
         JViewerApp.getInstance().getM_videorecord().StoreLocation = this.StoreLocation;
         VideoRecord.RecordStopTimer = Integer.parseInt(this.videoLengthText.getText());
         
         JViewerApp.getInstance().getJVMenu().notifyMenuStateEnable("VideoRecordStart", true);
         JViewerApp.getInstance().getJVMenu().notifyMenuStateEnable("VideoRecordStop", false);
         JViewerApp.getInstance().getJVMenu().notifyMenuStateEnable("VideoRecordSettings", true);
       }
     }
     
     if (paramActionEvent.getSource() == this.cancelButton) {
       close();
     }
     
 
     if (paramActionEvent.getSource() == this.recordMode)
     {
       if (!this.recordMode.isSelected()) {
         if (JOptionPane.showConfirmDialog(this.jContentPane, LocaleStrings.getString("V_11_VRS"), LocaleStrings.getString("V_7_VRS"), 2, 1) == 0)
         {
           JViewerApp.getInstance().getM_videorecord().singleVideo = false;
         } else {
           JViewerApp.getInstance().getM_videorecord().singleVideo = true;
           this.recordMode.setSelected(true);
         }
       } else {
         JViewerApp.getInstance().getM_videorecord().singleVideo = true;
         this.recordMode.setSelected(true);
       }
     }
   }
 }


/* Location:              D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\gui\VideoRecordSettings.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       0.7.1
 */